from pom.basepage import BasePage

class ReplyPage(BasePage):

    def reply(self,content):
        """
        发送回复内容
        :param content:
        :return:
        """
        self.driver.find_element_by_id('org.cnodejs.android.md:id/fab_reply').click()
        edit_content = self.driver.find_element_by_id('org.cnodejs.android.md:id/edt_content')
        edit_content.clear()
        edit_content.send_keys(content)

        # 点击发布
        self.driver.find_element_by_id('org.cnodejs.android.md:id/btn_tool_send').click()

    def click_up(self):
        # 获取所有的context
        allcontexts = self.driver.contexts
        print(allcontexts) # ['NATIVE_APP', 'WEBVIEW_org.cnodejs.android.md']
        # 切换到webview中
        self.driver.switch_to.context(allcontexts[-1])

        self.driver.find_element_by_xpath('//td[@class="right1"]').click()

        # 切换到原生app中
        self.driver.switch_to.context(allcontexts[0])